package org.UserHouse.Servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.UserHouse.Dao.AddressDao;
import org.UserHouse.Dao.Imp.AddressDaoImp;
import org.UserHouse.Dao.Imp.OrderDaoImp;
import org.UserHouse.Dao.OrderDao;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author bin
 * @date 2024-12-24
 */
@WebServlet("/del.Address.do")
public class DeleteAddressServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=UTF-8");
        PrintWriter out = resp.getWriter();

        int Aid = Integer.parseInt(req.getParameter("Aid"));

        AddressDao addressDao = new AddressDaoImp();
        int n = addressDao.DeleteAddress(Aid);
        out.println(n);

        out.flush();
        out.close();
    }
}
